
FIND_PATH(TRILINOS_INCLUDE_DIR Teuchos_Utils.hpp PATHS /opt/trilinos/include/ /usr/include/trilinos /usr/ljk/include/trilinos )


SET(CMAKE_REQUIRED_INCLUDES "${TRILINOS_INCLUDE_DIR};${CMAKE_REQUIRED_INCLUDES}")
MESSAGE( STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")


CHECK_INCLUDE_FILE_CXX("Teuchos_Utils.hpp" HAVE_TRILINOS_TEUCHOS  )
IF ( TRILINOS_LIB_TEUCHOS )
  SET( CMAKE_REQUIRED_FLAGS "-lteuchos;${CMAKE_REQUIRED_FLAGS}" )
ENDIF( TRILINOS_LIB_TEUCHOS )

CHECK_INCLUDE_FILE_CXX(Epetra_Vector.h HAVE_TRILINOS_EPETRA )
CHECK_INCLUDE_FILE_CXX(EpetraExt_VectorIn.h HAVE_TRILINOS_EPETRAEXT )
CHECK_INCLUDE_FILE_CXX(Trilinos_Util_CrsMatrixGallery.h HAVE_TRILINOS_TRIUTILS )
CHECK_INCLUDE_FILE_CXX(AztecOO.h HAVE_TRILINOS_AZTECOO )
CHECK_INCLUDE_FILE_CXX(AztecOO.h HAVE_AZTECOO_TEUCHOS )
CHECK_INCLUDE_FILE_CXX(Amesos.h HAVE_TRILINOS_AMESOS "-lteuchos ${MPI_EXTRA_LIBRARY} ${MPI_LIBRARY}")
CHECK_INCLUDE_FILE_CXX(Ifpack.h HAVE_TRILINOS_IFPACK "-lteuchos ${MPI_EXTRA_LIBRARY} ${MPI_LIBRARY}")
CHECK_INCLUDE_FILE_CXX(ml_config.h HAVE_TRILINOS_ML "-lteuchos ${MPI_EXTRA_LIBRARY} ${MPI_LIBRARY}")

IF( HAVE_TRILINOS_TEUCHOS )
  ADD_DEFINITIONS( -DHAVE_TRILINOS_TEUCHOS -DHAVE_TRILINOS_EPETRA -DHAVE_TRILINOS_EPETRAEXT -DAVE_TRILINOS_TRIUTILS -DHAVE_TRILINOS_AZTECOO -DHAVE_AZTECOO_TEUCHOS -DHAVE_TRILINOS_AMESOS -DHAVE_TRILINOS_IFPACK  -DHAVE_TRILINOS_ML -DML_MPI -DHAVE_ML_TEUCHOS -DHAVE_ML_EPETRA -DHAVE_ML_AZTECOO )
ENDIF( HAVE_TRILINOS_TEUCHOS )

FIND_LIBRARY(TRILINOS_LIB_TEUCHOS   teuchos   PATHS /opt/trilinos/lib /usr/ljk/lib )
FIND_LIBRARY(TRILINOS_LIB_EPETRA    epetra    PATHS /opt/trilinos/lib /usr/ljk/lib )
FIND_LIBRARY(TRILINOS_LIB_EPETRAEXT epetraext PATHS /opt/trilinos/lib /usr/ljk/lib )
FIND_LIBRARY(TRILINOS_LIB_TRIUTILS  triutils  PATHS /opt/trilinos/lib /usr/ljk/lib )
FIND_LIBRARY(TRILINOS_LIB_AZTECOO   aztecoo   PATHS /opt/trilinos/lib /usr/ljk/lib )
FIND_LIBRARY(TRILINOS_LIB_AMESOS    amesos    PATHS /opt/trilinos/lib /usr/ljk/lib )
FIND_LIBRARY(TRILINOS_LIB_IFPACK    ifpack    PATHS /opt/trilinos/lib /usr/ljk/lib )
FIND_LIBRARY(TRILINOS_LIB_ML        ml        PATHS /opt/trilinos/lib /usr/ljk/lib )

SET(TRILINOS_LIBRARIES
  ${TRILINOS_LIB_IFPACK}
  ${TRILINOS_LIB_AMESOS}
  ${TRILINOS_LIB_AZTECOO}
  ${TRILINOS_LIB_TRIUTILS}
  ${TRILINOS_LIB_EPETRAEXT}
  ${TRILINOS_LIB_EPETRA}
  ${TRILINOS_LIB_TEUCHOS}
)

